package com.cn.ztest;

import java.util.Map;

import org.junit.Test;

import com.cn.xc.utils.BeanUtil;

/**
 * FUN:
 * 
 * @author sushy
 * @date 2016-3-24
 */
public class BeanUtilTest {

	@Test
	public void test() {
		MyBean bean = new MyBean();
		bean.setId(111);
		bean.setName("tom");
		B b = new B();
		b.setD(12.0);
		bean.setBean(b);
		Map map = BeanUtil.toMap(bean);
		System.out.println(map);

		System.out.println("--------------------------");

		
	}

}

class MyBean {
	private Integer id;
	protected String name;
	public B bean;

	public B getBean() {
		return bean;
	}

	public void setBean(B bean) {
		this.bean = bean;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public String toString() {
		return "MyBean [id=" + id + ", name=" + name + ", bean=" + bean + "]";
	}

}

class B {
	double d;

	public double getD() {
		return d;
	}

	public void setD(double d) {
		this.d = d;
	}

	@Override
	public String toString() {
		return "B [d=" + d + "]";
	}

}
